package com.jahentao.integration;

import org.springframework.jms.core.JmsTemplate;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

/**
 * Created with IntelliJ IDEA.<br>
 * Description: Spring整合ActiveMQ 消费者<br>
 *     配置监听器
 * User: jahen<br>
 * Date: 2017-04-03<br>
 * Time: 14:44<br>
 */
public class SpringConsumer2 implements MessageListener{

    @Override
    public void onMessage(Message message) {
        TextMessage textMsg = (TextMessage) message;
        try {
            System.out.println("接收到了消息，消息内容是：" + textMsg.getText());
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }
}
